package aliyun

import (
	"crypto/hmac"
	"crypto/sha1"
	"encoding/base64"
	"net/url"
	"strings"
)

func hmac_sha1(s string) string {
	h := hmac.New(sha1.New, []byte(*fAccessKeySecret+"&"))
	h.Write([]byte(s))
	return base64.StdEncoding.EncodeToString(h.Sum(nil))
}

func url_encode(v string) string {
	return strings.Replace(url.QueryEscape(v), "+", "%20", -1)
}

func url_encode_vals(v url.Values) string {
	return strings.Replace(v.Encode(), "+", "%20", -1)
}
